package edu.asu.sapa.ground;

import edu.asu.sapa.lifted.Symbol;

public class Goal  {
	public int proposition;
	public float deadline=Float.POSITIVE_INFINITY;
	public float reward=0;
	public float penalty=Float.NEGATIVE_INFINITY;
	
	public Goal(int pid, float deadline, float reward, float penalty) {
		this.proposition = pid;
		this.deadline = deadline;
		this.reward = reward;
		this.penalty = penalty;
	}
	
	public Goal(int pid, float deadline) {
		this.proposition = pid;
		this.deadline = deadline;
	}
	
	public Goal(Goal goal) {
		proposition = goal.proposition;
		deadline = goal.deadline;
		reward = goal.reward;
		penalty = goal.penalty;
	}

	public String toString() {
		StringBuilder b = new StringBuilder();

		b.append("(:goal ");

//		if (name != null)
//			b.append(name).append(' ');
		if (deadline != Float.POSITIVE_INFINITY)
			b.append("(at ").append(deadline).append(' ');

		b.append(proposition);
		
		if (deadline != Float.POSITIVE_INFINITY)
			b.append(')');
		if (reward != 0 || penalty != Float.NEGATIVE_INFINITY) {
			b.append(" [").append(reward);
			if (penalty != Float.NEGATIVE_INFINITY) {
				b.append(", ").append(penalty).append(']');
			} else {
				b.append(']');
			}
		}
		b.append(')');

		return b.toString();
	}
}
